package it.asvp.asvp_portal.data.entity.domain;


import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "file", catalog = "asvp_db", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class File extends BaseEntity {

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	
	@Column(name = "name", nullable = false)
	private String name;
	
	@Lob
	@Column(name="data", nullable=false, columnDefinition="mediumblob")
	private byte[] data;
	
	public File() {
	}

	public File(String name, byte[] data, Date lastUpdate,
			Date createdOn) {
		this.name = name;
		this.data = data;
		this.lastUpdate = lastUpdate;
		this.createdOn = createdOn;
	}

	
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public byte[] getData() {
		return this.data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

}
